using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using CodePlex.Resourceful;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CodePlex.SpaceBlock.Test
{
    public abstract class BaseTest
    {

        protected void AssertAreEqual<T>(T[] expected, T[] actual)
        {
            if ((expected ?? actual) == null)
            {
                return;
            }
            if ( expected == null || actual ==null)
            {
                Assert.Fail("Expected {0}, found {1}", expected, actual);
            }
            Assert.AreEqual(expected.LongLength, actual.LongLength);

            for (long i = 0; i < expected.LongLength; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }



        }

        protected void AssertException(ThreadStart code)
        {

            try
            {
                code();
            }
            catch (Exception ex)
            {
                if (ex is CodePlexException)
                {
                    return;
                }

                Assert.Fail("Threw exception: " + ex.Message);
            }

            Assert.Fail("Expected exception");


        }
    }
}
